package br.edu.utfpr.backupTools.view.action.strategy;

import br.edu.utfpr.backupTools.util.enums.Acao;
import br.edu.utfpr.backupTools.view.action.AbstractCommand;
import br.edu.utfpr.backupTools.view.action.AbstractListCommand;
import br.edu.utfpr.backupTools.view.action.backup.*;
import br.edu.utfpr.backupTools.view.action.configuracao.ListarConfiguracao;
import br.edu.utfpr.backupTools.view.action.configuracao.SalvarConfiguracoes;
import java.util.HashMap;

public class Control {
    private static Control instance;
    private HashMap<Acao,AbstractCommand> commands = new HashMap<Acao,AbstractCommand>();
    private HashMap<Acao,AbstractListCommand> listCommands = new HashMap<Acao,AbstractListCommand>();

    public static Control getInstance() {
        if(instance == null)
        {
            instance = new Control();
        }
        return instance;
    }

    private Control() {
        init();
    }

    private void init(){
        commands.put(Acao.EXCLUIR_BACKUP, new ExcluirBackup());
        commands.put(Acao.GERAR_TODOS_BACKUPS, new GerarTodosBackups());
        commands.put(Acao.GERAR_BACKUP_INDIVIDUAL, new GerarBackupIndividual());
        commands.put(Acao.GERAR_RESTORE, new GerarRestore());
        commands.put(Acao.SALVAR_BACKUP, new SalvarBackup());
        commands.put(Acao.VERIFICA_BACKUP, new VerificaBackup());
        commands.put(Acao.SALVAR_CONFIGURACAO, new SalvarConfiguracoes());

        listCommands.put(Acao.LISTAR_BACKUP, new ListarBackup());
        listCommands.put(Acao.LISTAR_CONFIGURACAO, new ListarConfiguracao());
    }

    public HashMap<Acao,AbstractCommand> command(){
        return commands;
    }

    public HashMap<Acao,AbstractListCommand> listCommand(){
        return listCommands;
    }
}
